{template /common/header} 

<?php
if($_GET["type"]==1){
?>
<script type="text/javascript" src="{THEME_PATH}js/jquery_Validform.js"></script> 
<script type="text/javascript" src="{THEME_PATH}js/Validform_Datatype.js"></script>
<script type="text/javascript" src="{THEME_PATH}js/area.js"></script> 
<script>var ajaxurl = "{U('Address/getArea')}";</script>
<div class="app_body">
  <div class="app_gerenInfo">
    <p>尊敬的{$userInfoList[username]}，请您完善更多个人信息，有助于我们为您提供更加个性化的服务；我们承诺将尊重并保护您的隐私。</p>
    <form name="form1" action="{U('user/userInfo')}" method="post" class="secuform">
      <table>
        <tr>
          <td class="app_tdAlignRight tdWidth1" width="100">用户名：</td>
          <td>{$userInfoList[username]}</td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">真实姓名：</td>
          <td class="cityTd"><input type="text" name="true_name" id="true_name" value="{$userInfoList[true_name]}" class="textStyle"  datatype="*"   nullmsg="请输入真实姓名" errormsg="请输入真实姓名！"/></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">身份证号：</td>
          <td><input type="text" name="idcard" id="idcard" value="{$userInfoList[idcard]}" class="textStyle"  datatype="*"   nullmsg="请输入身份证号码" errormsg="请输入身份证号码！"/></td>
        </tr>
        <link rel="stylesheet" href="/statics/js/Editor/themes/default/default.css" />
        <script charset="utf-8" src="/statics/js/Editor/kindeditor-min.js"></script> 
        <script charset="utf-8" src="/statics/js/Editor/lang/zh_CN.js"></script>
        <tr style="display:none">
          <td class="app_tdAlignRight">身份证正面：</td>
          <td><img src="{if empty($userInfoList[zm_idcard])}/template/huigou/statics/images/homeimages/nopic.jpg{else}{$userInfoList[zm_idcard]}{/if}" id="zm_img" width="150" height="80" style="border:2px dashed #39F;border-radius:2px; width:auto"><br />
            <input type="hidden" name="zm_idcard" id="zm_idcard" value="{$userInfoList[zm_idcard]}" />
            </td>
        </tr>
        <tr style="display:none">
          <td class="app_tdAlignRight">身份证反面：</td>
          <td><img src="{if empty($userInfoList[fm_idcard])}/template/huigou/statics/images/homeimages/nopic.jpg{else}{$userInfoList[fm_idcard]}{/if}" id="fm_img" width="150" height="80"  style="border:2px dashed #39F;border-radius:2px; width:auto"><br />
            <input type="hidden" name="fm_idcard" id="fm_idcard" value="{$userInfoList[fm_idcard]}"/>
            </td>
        </tr>
        <script>
      KindEditor.ready(function(K) {
        editor = K.editor({
                    uploadJson : '<?php echo U("User/Editor/upload?SSID=",'','');?>'+'<?php echo C("SSID");?>',
                    extraFileUploadParams: {
                         PHPSESSID : '<?php echo session_id() ?>',
                         parentdir : 'idcard/'
                    },
                    allowFileManager: true
                });
        K('#zm_img').click(function() {
          editor.loadPlugin('image', function() {
            editor.plugin.imageDialog({
              showRemote : false,
              imageUrl : K('#zm_idcard').val(),
              clickFn : function(url, title, width, height, border, align) {
                K('#zm_idcard').val(url);
                $("#zm_img").attr("src",url);
                //K('#J_imageView_dan').html('<img src="' + url + '">');
                editor.hideDialog();
              }
            });
          });
        });
        K('#fm_img').click(function() {
          editor.loadPlugin('image', function() {
            editor.plugin.imageDialog({
              showRemote : false,
              imageUrl : K('#fm_idcard').val(),
              clickFn : function(url, title, width, height, border, align) {
                K('#fm_idcard').val(url);
                 $("#fm_img").attr("src",url);
                //K('#J_imageView_dan').html('<img src="' + url + '">');
                editor.hideDialog();
              }
            });
          });
        });
      });
    </script>
        <tr>
          <td class="app_tdAlignRight">性别：</td>
          <td class="dataOption"><label>
              <input type="radio" name="sex" id="xb" value="0" 
                                             {if $userInfoList[sex] == 0}checked {/if}/>
              保密</label>
            <label>
              <input type="radio" name="sex" id="xb" value="1" 
                                        {if $userInfoList[sex] == 1}checked {/if}     />
              男</label>
            <label>
              <input type="radio" name="sex" id="xb" value="2" 
                                        {if $userInfoList[sex] == 2}checked {/if}     />
              女</label></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">联系电话：</td>
          <td>{$userInfoList[mobile_phone]}
            <input type="hidden" name="mobile_phone" id="mobile_phone" value="{$userInfoList[mobile_phone]}" class="textStyle" /></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">邮箱：</td>
          <td><input type="text" name="email" id="email" value="{$userInfoList[email]}" class="textStyle"  datatype=""   nullmsg="请输入邮箱" errormsg="请输入邮箱"/></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">QQ：</td>
          <td><input type="text" name="qq" id="qq" value="{$userInfoList[qq]}" class="textStyle"  datatype=""   nullmsg="请输入QQ" errormsg="请输入QQ！"/></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">所在地区：</td>
          <td><select name="province" id="province" onChange="loadArea(this.value, 'city')" style="height:30px; border:1px solid #ccc; width:90%;">
              <option value="-1" selected>--请选择省份--</option>
              <?php
                        foreach($region as $v){
						?>
              <option value="<?php echo $v["area_id"]?>" <?php if($userInfoList["province"]==$v["area_id"]){?> selected="selected"<?php }?>><?php echo $v["area_name"]?></option>
              <?php
							  }
						?>
            </select>
            <select name="city" id="city" onChange="loadArea(this.value, 'district')" style="height:30px; border:1px solid #ccc; width:90%;">
              <option value="-1">--请选择城市--</option>
              <?php
                    	
                        foreach($city as $v){
						?>
              <option value="<?php echo $v["area_id"]?>" <?php if($userInfoList["city"]==$v["area_id"]){?> selected="selected"<?php }?>><?php echo $v["area_name"]?></option>
              <?php
							  }
							
						?>
            </select>
            <select name="district" id="district" onChange="loadArea(this.value, 'null')" style="height:30px; border:1px solid #ccc; width:90%;">
              <option value="-1">--请选择地区--</option>
              <?php
                     
                        foreach($district as $v){
						?>
              <option value="<?php echo $v["area_id"]?>" <?php if($userInfoList["district"]==$v["area_id"]){?> selected="selected"<?php }?>><?php echo $v["area_name"]?></option>
              <?php
							  }
							
						?>
            </select></td>
        </tr>
        <tr>
          <td class="app_tdAlignRight">地址：</td>
          <td><input type="text" name="address" id="address" value="{$userInfoList[address]}" class="textStyle"  datatype="*"   nullmsg="请输入详细地址" errormsg="请输入详细地址！"/></td>
        </tr>
      </table><button type="submit" class=" btnBlue" style="width:100%">提交</button>
    </form>
  </div>
</div>
<script type="text/javascript">
            $(function() {
                $(".secuform").Validform({
                    tiptype: 4,
                    ajaxPost: true,
                    callback: function(data) {
                        if (data.status == '1') {
                            alert(data.info);
                            location.href = "{U('user/userinfo')}";
                        }else{
                            alert(data.info);
                        }
                    }
                });
                var sp = $(".toux img,#toux");
                sp.hover(function(){
                    $("#toux").stop().animate({bottom:0});
                },function(){
                    $("#toux").stop().animate({bottom:'-20px'});
                });
            });
        </script>
<?php
}else{
?>
<div class="app_body">
  <div class="app_userInfo div1"> <span>会员资料</span> <a href="{U('user/userinfo',array('type'=>1))}">修改</a> </div>
  <?php
if($userInfoList["user_type"]==2){
?>
  <div class="app_userInfo"> <span>商家资料</span> <a href="{U('user/userinfocompany')}">修改</a> </div>
  <?php
  }
  ?>
  <div class="app_userInfo div1"> <span>收货地址</span> <a href="{U('address/address')}">修改</a> </div>
</div>
<div class="app_userAnQuan">
  <div class="app_userInfo div1"> <span>账户安全</span> </div>
  <div class="app_userInfo"> <span>绑定手机<font></font></span> <a href="{U('user/update_phone')}">修改</a> </div>
  <div class="app_userInfo"> <span>登录密码</span> <a href="{U('user/security')}">修改</a> </div>
  <div class="app_userInfo"> <span>二级密码</span> <a href="{U('user/pinpass')}">修改</a> </div>
</div>
<?php
}
?>
{template /common/footer}